﻿<Window x:Class="OOLibTestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:oo="clr-namespace:OOLib;assembly=OpenOfficeLib"
        Title="MainWindow" Height="350" Width="525"
        Loaded="Window_Loaded"
        Closed="Window_Closed">
  
  <DockPanel DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=.}">
    <ToolBarTray DockPanel.Dock="Top">
      <ToolBar Band="0">
        <Button Content="New TextDoc"
                x:Name="NewTextDocButton" Click="NewTextDocButton_Click"/>
      </ToolBar>
    </ToolBarTray>
    
    <ListBox x:Name="DocList" DockPanel.Dock="Top" Height="100"
             ItemsSource="{Binding Path=Docs}"
             SelectedItem="{Binding Path=SelectedDocument}">
      <ListBox.ItemTemplate>
        <DataTemplate DataType="{x:Type oo:OfficeDocument}">
          <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Path=Url}"/>
            <TextBlock Text=" ("/>
            <TextBlock Text="{Binding Path=DocType}"/>
            <TextBlock Text=")"/>
          </StackPanel>
        </DataTemplate>
      </ListBox.ItemTemplate>
    </ListBox>

    <ToolBar DockPanel.Dock="Top" DataContext="{Binding Path=SelectedDocument}">
      <CheckBox x:Name="DocIsVisible" Content="IsVisible" 
                IsChecked="{Binding Path=CurrentController.Frame.ContainerWindow.IsVisible, Mode=TwoWay}"/>
      <Button x:Name="DocSaveButton" Content="Save" Click="DocSaveButton_Click"/>
      <Button x:Name="DocSaveAsButton" Content="Save as" Click="DocSaveAsButton_Click"/>
      <Button x:Name="DocCloseButton" Content="Close" Click="DocCloseButton_Click"/>
    </ToolBar>

    <Grid DockPanel.Dock="Top" DataContext="{Binding Path=SelectedDocument}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <TextBlock Grid.Row="0" Grid.Column="0" Text="Url" VerticalAlignment="Center" Margin="6,1"/>
      <TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="6,1"
               Text="{Binding Path=Url, Mode=OneWay}" IsReadOnly="True"/>

      <!--TextBlock Grid.Row="1" Grid.Column="0" Text="IsVisible" VerticalAlignment="Center" Margin="6,1"/>
      <TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="6,1"
               Text="{Binding Path=IsVisible, Mode=OneWay}" IsReadOnly="True"/>

      <TextBlock Grid.Row="2" Grid.Column="0" Text="DocType" VerticalAlignment="Center" Margin="6,1"/>
      <TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="6,1"
               Text="{Binding Path=DocType, Mode=OneWay}" IsReadOnly="True"/-->
    </Grid>

    <TextBox x:Name="Results" IsReadOnly="True"/>
  </DockPanel>
</Window>
